<script type="module">
import ajax from './ajax.js'
const arr = [1,2,3]
// ajax('./1.json').then(v => console.log(v))
// ajax('./2.json').then(v => console.log(v))
// ajax('./3.json').then(v => console.log(v))
const promises = arr.map(n => `./${n}.json`)
  .map(url => ajax(url))
Promise.all(promises)
  .then(arr => arr.reduce(
    (s, item) => [...s, ...item], [])
  )
  .then(arr => console.log(arr))
</script>